/*
 RLEditRecyclableItemViewController.h
 Date Created: February 20, 2010
 
 Author: Karol Krizka <kkrizka@gmail.com>
 
 Copyright (C) 2010 Green-Power
 
 URL: http://code.google.com/p/green-power
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 $Id$
 */

#import <UIKit/UIKit.h>

#import "RLRecyclableItem.h"

/**
 * Responsible for editing a recyclable item. This is just the quantity returned.
 * Does not save the managed object context model.
 *
 * The view does not have any save/cancel buttons. It is up to the called to
 * implement those. This gives flexibility as to how the view is displayed.
 */
@interface RLEditRecyclableItemViewController : UIViewController {
  UIImageView *typeIconView;
  UILabel *typeNameLabel;
  UILabel *depositValueLabel;
  UILabel *quantityLabel;
  UILabel *totalValueLabel;
  UIButton *plusButton;
  UIButton *minusButton;
  
  RLRecyclableItem *item;
}

@property (nonatomic,retain) IBOutlet UIImageView *typeIconView;
@property (nonatomic,retain) IBOutlet UILabel *typeNameLabel;
@property (nonatomic,retain) IBOutlet UILabel *depositValueLabel;
@property (nonatomic,retain) IBOutlet UILabel *quantityLabel;
@property (nonatomic,retain) IBOutlet UILabel *totalValueLabel;
@property (nonatomic,retain) IBOutlet UIButton *plusButton;
@property (nonatomic,retain) IBOutlet UIButton *minusButton;

@property (nonatomic,retain,readonly) RLRecyclableItem *item;

/**
 * Initialize the edit view with an item
 */
- (RLEditRecyclableItemViewController *)initWithItem:(RLRecyclableItem *)item;

/**
 * Updates the labels to the correct values corresponding to the values stored
 * in the |item| variable.
 */
- (void)updateLabels;

/**
 * Updates the state of the +/- buttons to ensure that bad actions will not 
 * occur.
 * Currently this just means that the - button is disabled if the quantity of
 * items is 0.
 */
- (void)updateButtons;

/**
 * Increment the quantity of items by one
 */
- (IBAction)incrementQuantity;

/**
 * Decrement the quantity of items by one. Does nothing if the quantity is 0.
 */
- (IBAction)decrementQuantity;

@end
